﻿namespace PowerSong.UserInterface
    {
    using System.Collections.Generic;
    using System.ComponentModel;

    public class CheckListBoxItem : INotifyPropertyChanged
        {

        public event PropertyChangedEventHandler PropertyChanged;

        private object value = null;

        public object Value
            {
            get
                {
                return this.value;
                }
            set
                {
                this.value = value;
                if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("Value"));
                }
            }

        private bool isChecked = false;

        public bool IsChecked
            {
            get
                {
                return this.isChecked;
                }
            set
                {
                this.isChecked = value;
                if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs("IsChecked"));
                }
            }


        public CheckListBoxItem()
            {
            this.IsChecked = false;
            }

        public CheckListBoxItem(object value, bool isChecked = false)
            {
            this.Value = value;
            this.IsChecked = isChecked;
            }

        public static CheckListBoxItem[] CreateItems(params object[] items)
            {
            var result = new List<CheckListBoxItem>();
            foreach (var item in items)
                {
                result.Add(new CheckListBoxItem(item));
                }
            return result.ToArray();
            }

        }

    }
